package v1

import "time"

type AddArticleRequest struct {
	AuthorId int64  `json:"authorId" binding:"required"`
	TagId    int64  `json:"tagId" binding:"required"`
	Title    string `json:"title" binding:"required"`
	Describe string `json:"describe"`
	Content  string `json:"content" binding:"required"`
	Type     int8   `json:"type" binding:"required"`
}

type DeleteArticleRequest struct {
	ArticleId int64 `uri:"articleId" binding:"required"`
}

type DeleteArticleResponse struct {
	ArticleId int64 `json:"articleId"`
}

type UpdateArticleRequest struct {
	ArticleId int64  `json:"articleId" binding:"required"`
	TagId     int64  `json:"tagId"`
	Title     string `json:"title"`
	Describe  string `json:"describe"`
	Content   string `json:"content"`
	Status    int8   `json:"status"`
}

type GetArticleProfileRequest struct {
	ArticleId int64 `uri:"articleId" binding:"required"`
}

type GetArticleProfileResponse struct {
	ArticleId int64       `json:"articleId"`
	Author    string      `json:"author"`
	TagId     int64       `json:"tagId"`
	Title     string      `json:"title"`
	Describe  string      `json:"describe"`
	Content   string      `json:"content"`
	Type      int8        `json:"type"`
	Status    int8        `json:"status"`
	CreatedAt time.Time   `json:"createdAt"`
	UpdatedAt time.Time   `json:"updatedAt"`
	DeletedAt interface{} `json:"deletedAt"`
}

type GetAllArticleRequest struct {
	Page     int `form:"page" binding:"required"`
	PageSize int `form:"pageSize" binding:"required"`
}

type GetAllArticleResponse struct {
	Total  int64                       `json:"total"`
	Record []GetArticleProfileResponse `json:"record"`
}

type GetArticleByUserIdRequest struct {
	UserId   int64 `uri:"userId" binding:"required" example:"1"`
	Page     int   `form:"page"`
	PageSize int   `form:"pageSize"`
}

type GetArticleByUserIdResponse struct {
	Total  int64                       `json:"total"`
	Record []GetArticleProfileResponse `json:"record"`
}

type GetArticleByTagIdRequest struct {
	TagId    int64 `uri:"tagId" binding:"required" example:"1"`
	Page     int   `form:"page"`
	PageSize int   `form:"pageSize"`
}

type GetArticleByTagIdResponse struct {
	Total  int64                       `json:"total"`
	Record []GetArticleProfileResponse `json:"record"`
}

type GetArticleByTitleReq struct {
	Title    string `form:"title" binding:"required"`
	Page     int    `form:"page"`
	PageSize int    `form:"pageSize"`
}

type GetArticleByTitleResp struct {
	Total  int64                       `json:"total"`
	Record []GetArticleProfileResponse `json:"record"`
}
